<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>管理员门户 - 银行系统</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css">
    <style>
        /* 保留原有的样式 */
        :root {
            --primary: #1a2a6c;
            --secondary: #b21f1f;
            --accent: #fdbb2d;
        }
        
        body {
            background-color: #f8f9fa;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }
        
        .sidebar {
            background: linear-gradient(180deg, var(--primary), #0d1a4a);
            color: white;
            height: 100vh;
            position: fixed;
            padding-top: 20px;
            box-shadow: 3px 0 15px rgba(0,0,0,0.2);
            width: 250px;
            z-index: 100;
        }
        
        .sidebar .nav-link {
            color: rgba(255,255,255,0.85);
            padding: 12px 20px;
            margin: 5px 15px;
            border-radius: 5px;
            transition: all 0.3s;
            display: flex;
            align-items: center;
        }
        
        .sidebar .nav-link:hover, .sidebar .nav-link.active {
            background: rgba(255,255,255,0.15);
            color: white;
        }
        
        .sidebar .nav-link i {
            margin-right: 12px;
            font-size: 1.2rem;
            width: 24px;
            text-align: center;
        }
        
        .main-content {
            margin-left: 250px;
            padding: 20px;
            min-height: 100vh;
        }
        
        .header {
            background: white;
            padding: 15px 25px;
            border-bottom: 1px solid #eee;
            display: flex;
            justify-content: space-between;
            align-items: center;
            box-shadow: 0 2px 10px rgba(0,0,0,0.05);
            position: sticky;
            top: 0;
            z-index: 99;
        }
        
        .stat-card {
            background: white;
            border-radius: 12px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.08);
            padding: 25px;
            margin-bottom: 25px;
            transition: transform 0.3s, box-shadow 0.3s;
            height: 100%;
        }
        
        .stat-card:hover {
            transform: translateY(-7px);
            box-shadow: 0 8px 20px rgba(0,0,0,0.12);
        }
        
        .stat-card i {
            font-size: 2.8rem;
            color: var(--primary);
            margin-bottom: 15px;
        }
        
        .stat-card .number {
            font-size: 2.2rem;
            font-weight: bold;
            margin: 10px 0;
            color: var(--primary);
        }
        
        .stat-card .label {
            color: #6c757d;
            font-size: 0.95rem;
        }
        
        .welcome-section {
            background: linear-gradient(90deg, #ffffff, #f8f9fa);
            border-radius: 15px;
            padding: 30px;
            margin-bottom: 30px;
            box-shadow: 0 6px 15px rgba(0,0,0,0.08);
            border-left: 5px solid var(--primary);
        }
        
        .logout-btn {
            background: var(--primary);
            color: white;
            border: none;
            padding: 8px 20px;
            border-radius: 30px;
            font-weight: 500;
            transition: all 0.3s;
            display: flex;
            align-items: center;
        }
        
        .logout-btn:hover {
            background: #0d1a4a;
            transform: translateY(-2px);
        }
        
        .user-info {
            display: flex;
            align-items: center;
        }
        
        .user-avatar {
            width: 45px;
            height: 45px;
            border-radius: 50%;
            background: var(--primary);
            color: white;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
            font-size: 1.2rem;
            margin-right: 12px;
        }
        
        .recent-table th {
            background: #f1f5f9;
            color: var(--primary);
            font-weight: 600;
        }
        
        .income {
            color: #28a745;
            font-weight: 500;
        }
        
        .expense {
            color: #dc3545;
            font-weight: 500;
        }
        
        /* 新增管理页面样式 */
        .management-card {
            border-radius: 12px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.08);
            margin-bottom: 25px;
        }
        
        .table-hover tbody tr:hover {
            background-color: rgba(26, 42, 108, 0.05);
        }
    </style>
</head>
<body>
    <div class="sidebar">
        <div class="text-center mb-4 px-3">
            <h3>银行管理系统</h3>
            <p class="text-light opacity-75">管理员控制台</p>
        </div>
        
        <ul class="nav flex-column">
            <li class="nav-item">
                <a class="nav-link" href="{{ url_for('admin_portal') }}">
                    <i class="bi bi-speedometer2"></i> 控制面板
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link active" href="{{ url_for('manage_customers') }}">
                    <i class="bi bi-people"></i> 客户管理
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="{{ url_for('manage_cards') }}">
                    <i class="bi bi-credit-card"></i> 银行卡管理
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="{{ url_for('manage_deposits') }}">
                    <i class="bi bi-cash-coin"></i> 存款业务
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="#">
                    <i class="bi bi-graph-up"></i> 交易管理
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="#">
                    <i class="bi bi-file-earmark-bar-graph"></i> 报表统计
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="#">
                    <i class="bi bi-shield-lock"></i> 安全管理
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="#">
                    <i class="bi bi-gear"></i> 系统设置
                </a>
            </li>
        </ul>
        
        <div class="mt-auto px-4 py-3 text-center text-light opacity-75" style="font-size: 0.85rem;">
            &copy; 2025 文睿银行系统 v2.0
        </div>
    </div>
    
    <div class="main-content">
        <div class="header">
            <h4 class="mb-0">管理员控制面板</h4>
            <div class="d-flex align-items-center">
                <div class="user-info me-4">
                    <div class="user-avatar">{{ session.fullname[0] }}</div>
<div>
    <div class="fw-bold">{{ session.fullname }}</div>
    <div class="small text-muted">上次登录: {{ session.login_time }}</div>
</div>
                </div>
                <a href="{{ url_for('logout') }}" class="logout-btn">
                    <i class="bi bi-box-arrow-right me-2"></i> 退出系统
                </a>
            </div>
        </div>
        
        <!-- 消息闪现 -->
        {% with messages = get_flashed_messages(with_categories=true) %}
            {% if messages %}
                <div class="container mt-3">
                    {% for category, message in messages %}
                        <div class="alert alert-{{ category }} alert-dismissible fade show" role="alert">
                            {{ message }}
                            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                        </div>
                    {% endfor %}
                </div>
            {% endif %}
        {% endwith %}
        
        {% block content %}{% endblock %}
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        // 实时更新时间
        function updateTime() {
            const now = new Date();
            const timeString = now.toLocaleTimeString('zh-CN', {hour: '2-digit', minute:'2-digit'});
            document.querySelector('.header h4').textContent = `管理员控制面板 · ${timeString}`;
        }
        
        // 初始更新时间
        updateTime();
        // 每分钟更新一次
        setInterval(updateTime, 60000);
    </script>
</body>
</html>